package com.cskaoyan._10exception._02handle;

/**
 * @author Macro_Ray
 * @since 2024/3/19 11:33
 */
//
public class TryDemo2 {
    public static void main(String[] args) {
        try {
            int i = 1 / 0;
        } catch (ArithmeticException e) {
            System.out.println("算数异常");
            e.printStackTrace();
        } catch (NullPointerException e) {
            System.out.println("空指针异常");
            e.printStackTrace();
        }
    }

    private static void test1(int num){
        if(num == 0){
            int i = 1 / 0;
        }else if(num == 1){
            String s =null;
            s.length();

        }
    }
}
